cmake_minimum_required(VERSION 3.20)
project(pb3_c++)

# 如果代码需要支持C++14，就直接加上这句
set(CMAKE_CXX_STANDARD 14)
# 如果想要生成的可执行文件拥有符号表，可以gdb调试，就直接加上这句
add_definitions("-Wall -g")

# 设置变量，下面的代码都可以用到
set(PROTO_PB_DIR ${PROJECT_SOURCE_DIR}/proto_pb3)


# 编译子文件夹的CMakeLists.txt
add_subdirectory(proto_pb3)

# 规定.h头文件路径
include_directories(${PROJECT_SOURCE_DIR}
        ${PROTO_PB_DIR}
        )

# 生成可执行文件
add_executable(${PROJECT_NAME}
        pb3_test.cpp )

# 链接操作
target_link_libraries(${PROJECT_NAME}
        general_pb3)

install(TARGETS ${PROJECT_NAME}
        RUNTIME DESTINATION ${PROJECT_SOURCE_DIR})
